﻿using SQLiteDB;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Utils.Common;
using ZK.Entity;

namespace ZK.BLL
{
   public class VDJTemplateBLL
    {

        private VDJTemplateBLL() { }
        /// <summary>
        /// 窗体对象实例
        /// </summary>
        private static VDJTemplateBLL _instance;
        public static VDJTemplateBLL Instance
        {
            get
            {
                if (_instance == null)
                    _instance = new VDJTemplateBLL();
                return _instance;
            }
        }

 

        public string GetNewID()
        {
            return BaseIdGenerator.Instance.GetId();
        }

        public List<VDJTemplate> GetList()
        {
            List<VDJTemplate> list;
            string sql = "Select * from VDJTemplate  Order BY Id ";
            list = SQLiteORM.Instance.GetEntityList<VDJTemplate>(sql);
            return list;
        }

        public bool Insert(VDJTemplate template)
        {

            return SQLiteORM.Instance.Insert<VDJTemplate>(template);
        }


        public bool DeleteById(string id)
        {
            return SQLiteORM.Instance.Delete($"DELETE FROM VDJTemplate WHERE Id='{id}'");
        }


        public VDJTemplate GetByTemplateName(string templateName)
        {

            string sql = $"Select * from VDJTemplate WHERE TemplateName ='{templateName}'  ";
            return SQLiteORM.Instance.GetEntity<VDJTemplate>(sql);

        }

    }
}
